package com.j283_5.wisdom_park.controller.investment_management.customer_development;


import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.j283_5.wisdom_park.common.result.ResultData;
import com.j283_5.wisdom_park.pojo.CustomerDevelopment;
import com.j283_5.wisdom_park.pojo.Person;
import com.j283_5.wisdom_park.pojo.Visitors;
import com.j283_5.wisdom_park.service.AnnouncementService;
import com.j283_5.wisdom_park.service.CustomerDevelopmentService;
import com.j283_5.wisdom_park.vo.contract_management.CustomerNeedsVo;
import com.j283_5.wisdom_park.vo.contract_management.CustomerVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 客户管理 前端控制器
 * </p>
 *
 * @author 冯弋舟
 * @since 2022-04-28
 */
@RestController
@RequestMapping("/customer-development")
@Api(value = "客户管理",tags = "客户管理",produces="冯弋舟")
public class CustomerDevelopmentController {

    @Resource
    private CustomerDevelopmentService service;
    @Resource
    private AnnouncementService announcementService;

    /**
     * 多条件查询客户信息
     * @return
     */
    @RequestMapping(value = "/findCustomer" , method = RequestMethod.GET)
    @ApiOperation(value = "查询所有客户信息",notes = "查询所有客户信息（分页）",produces="冯弋舟", response = ResultData.class)
    public ResultData findCustomer(@Param("page") Page<Visitors> page, @Param("customerVo") CustomerVo customerVo){
        Map<String, Object> map = service.findCustomer(customerVo, (int) page.getCurrent(), (int) page.getSize());
        return ResultData.ok().data(map);
    }

    /**
     * 根据客户id查询客户基本信息
     * @return
     */
    @RequestMapping(value = "/findCustomerInfo" , method = RequestMethod.POST)
    @ApiOperation(value = "根据客户id查询客户基本信息",notes = "根据客户id查询客户基本信息",produces="冯弋舟", response = ResultData.class)
    public ResultData findCustomerInfo(Integer cusId ){

        Map<String, Object> map = service.findCustomerById(cusId);
        return ResultData.ok().data(map);
    }

    /**
     * 根据客户id查询跟进情况
     * @return
     */
    @RequestMapping(value = "/Follow_situation" , method = RequestMethod.POST)
    @ApiOperation(value = "根据客户id查询跟进情况",notes = "根据客户id查询跟进情况",produces="冯弋舟", response = ResultData.class)
    public ResultData Follow_situation(Integer cus_id ){


        return service.Follow_situation(cus_id);
    }

    /**
     * 插入客户信息
     * @return
     */
    @RequestMapping(value = "/insertCustomer" , method = RequestMethod.POST)
    @ApiOperation(value = "插入客户信息",notes = "插入客户信息",produces="冯弋舟", response = ResultData.class)
    public ResultData InsertCustomer(CustomerNeedsVo customerNeedsVo,CustomerVo customerVo){
          return   service.InsertCustomer(customerNeedsVo,customerVo);

    }

    /**
     * 进入插入客户信息界面
     * @return
     */
    @RequestMapping(value = "/insertCustomerInterface" , method = RequestMethod.POST)
    @ApiOperation(value = "进入插入客户信息界面",notes = "进入插入客户信息界面",produces="冯弋舟", response = ResultData.class)
    public ResultData insertCustomerInterface(){
        return   announcementService.AnnRoom();

    }

    /**
     * 编辑客户信息
     * @return
     */
    @RequestMapping(value = "/updateCustomer" , method = RequestMethod.POST)
    @ApiOperation(value = "编辑客户信息",notes = "编辑客户信息",produces="冯弋舟", response = ResultData.class)
    public ResultData UpdateCustomer(@Param("customerNeedsVo") CustomerNeedsVo customerNeedsVo, @Param("customerVo") CustomerVo customerVo){



        return service.UpdateCustomer(customerNeedsVo,customerVo);
    }

    /**
     * 删除客户信息
     * @return
     */
    @RequestMapping(value = "/deleteCustomer" , method = RequestMethod.POST)
    @ApiOperation(value = "删除客户信息",notes = "删除客户信息",produces="冯弋舟", response = ResultData.class)
    public ResultData DeleteCustomer(@RequestBody List<Integer> listCustomer){


        return service.DeleteCustomer(listCustomer);
    }


}

